class MessagesController < ApplicationController

  def show

  end

  def create
    @message = Message.new(params[:message])
    @message.user_id = current_user.id
    @message.group_id = params[:group_id]
    if @message.save
      render "show"
    else
      render :json => {:response => 'error'}.to_json, :status => :conflict
    end
  end

  def all_after
    @messages = Message.where("group_id = ? and created_at >= ?", params[:group_id], params[:time])
  end
end
